package com.hanamaki.basic.method;

import java.util.Scanner;

public class Demo12 {

    public static void main(String[] args) {
        calc();
    }

    public static void calc() {

        System.out.println("请输入第一个数字：");
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        System.out.println("请输入第一个数字：");
        int b = scanner.nextInt();
        System.out.println("请输入运算符号：");
        String c = scanner.next();

        switch (c) {
            case "+":
                System.out.println(add(a, b));
            break;
            case "-":
                System.out.println(less(a, b));
                break;
            case "*":
                System.out.println(mul(a, b));
                break;
            case "/":
                System.out.println(chu(a, b));
                break;
            default:
                System.out.println("运算表达式不合法！");;
        }
    }

    //    加减乘除
    public static int add(int a, int b) {
        return a + b;
    }
    public static int less(int a, int b) {
        return a - b;
    }
    public static int mul(int a, int b) {
        return a * b;
    }public static int chu(int a, int b) {
        return a / b;
    }

}
